//
// Created by Administrator on 2021/9/15.
//

#include<stdio.h>
#include<stdlib.h>

void yanghui(int row){
    int ** triangle = (int**)calloc(row,sizeof(int*));
    for(int i=0;i<row;i++){
        triangle[i] = (int*)calloc(i+1,sizeof(int));
        for(int col = 0;col <=i ;col++){
            if(col==0||col==i) {
                triangle[i][col] = 1;
            }else{
                triangle[i][col] = triangle[i-1][col-1] + triangle[i-1][col];
            }
            printf("%d ",triangle[i][col]);
        }
        printf("\n");
    }
    for(int i=0;i<row;i++){
        free(triangle[i]);
    }
    free(triangle);
}
